package com.power.sifa.std.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  常用语实体类
*/

@Entity
@ApiModel(value="常用语")
@Data
@Table(name="Std_comword",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Std_comword.Std_comwordPK.class) 用于复合组件
public class Std_comword extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_std_comword")
    @SequenceGenerator(name = "seq_std_comword", sequenceName = "SEQ_STD_COMWORD", allocationSize = 1)
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private Integer id;

    @ApiModelProperty(value = "类别")
    private Integer category;

    @ApiModelProperty(value = "内容")
    private String content;

    @ApiModelProperty(value = "创建人")
    private String createuserid;

    @ApiModelProperty(value = "顺序号")
    private String sortnum;

    @ApiModelProperty(value = "状态")
    private Integer status;

    /**
     *  状态文本
     */
    @Transient
    @FieldEnumText(eum="yesNo", valuefield="status")
    private String status_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("category", this.getCategory());
        map.put("content", this.getContent());
        map.put("createuserid", this.getCreateuserid());
        map.put("sortnum", this.getSortnum());
        map.put("status_text", this.status_text);
        map.put("status", this.getStatus());
        return map;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (Integer) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Std_comwordPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (Integer)key;

        //Std_comwordPK pk = (Std_comwordPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
